feat(providers): add Google Veo API package#80
Conversation
## Client (GoogleVeoClient mixin)
- HTTP POST to /v1beta/models/{model_id}:predictLongRunning endpoint
- Async polling for long-running video generation operations
- Parse generatedSamples[0].video from response
- Download video content from GCS URLs
## Parameters
- AspectRatioMapper: parameters.aspectRatio
- ResolutionMapper: parameters.resolution
- DurationSecondsMapper: parameters.durationSeconds
- ReferenceImagesMapper: instances.referenceImages with base64 encoding
- FirstFrameMapper: instances.image for image-to-video
- LastFrameMapper: instances.lastFrame for interpolation
## Config
- API base URL: https://generativelanguage.googleapis.com
- Endpoints: predictLongRunning, operation polling
- Polling interval: 10s, timeout: 300s
- GCS storage URL for video downloads
- Update GoogleVideoGenerationClient to extend GoogleVeoClient mixin - Simplify client by delegating HTTP, polling, downloads to API layer - Update parameter mappers to extend base Veo API mappers - Remove config.py (now in API layer) - Add celeste-google as workspace dependency - Fix _create_inputs to get prompt from parameters dict
Converts ImageArtifact to base64 data URI string for API requests that require inline image data (e.g., Google Veo reference images).
Code Review - PR #80: Google Veo API PackageSummaryThis PR successfully extracts Google Veo video generation into a reusable API layer following the established mixin pattern (GenerateContent, Imagen). The architecture is clean and the refactoring significantly reduces code duplication. Overall, this is a well-executed refactoring with strong architectural alignment. ✅ StrengthsArchitecture & Design
Code Quality
|
🔍 Issues & Concerns (Part 1)1. Security: Infinite Polling Loop
|
🔍 Issues & Concerns (Part 2)4. Potential Bug: URL Handling in image_to_data_uriLocation: src/celeste/utils.py:8-32 The function only handles data or path attributes, but ImageArtifact also has a url attribute. If an artifact has only a URL (e.g., from a previous generation), this function will silently fail with an unclear error. Recommendation: Add explicit handling for the url case with a clear error message explaining that URL-based images need to be downloaded first. 5. Performance: Redundant Operations in Parameter MappingLocation: packages/providers/google/src/celeste_google/veo/parameters.py:95-103 The code converts to data URI string, then immediately parses it back: data_uri = image_to_data_uri(img)
header, encoded = data_uri.split(",", 1)
mime_type = header.split(":")[1].split(";")[0]Recommendation: Consider creating a separate function that returns the components directly to avoid the string concatenation and parsing overhead. 6. Type Safety: Missing Return Type AnnotationLocation: packages/providers/google/src/celeste_google/veo/client.py:99 Using Any as return type loses type safety. The function clearly returns a dict. Current: Recommended: |
🧪 Test CoverageMissing TestsThe PR doesn't include unit tests for the new GoogleVeoClient mixin or parameter mappers. While integration tests exist, consider adding:
📊 Performance ConsiderationsPolling Efficiency
Memory Usage
|
🔐 Security Considerations✅ Good Practices
📝 Breaking ChangesThe parameter mapper rename is well-documented in the PR description:
Recommendation: Ensure this is documented in CHANGELOG/release notes. 🎯 Recommendations SummaryMust Fix (High Priority)
Should Fix (Medium Priority)
Nice to Have (Low Priority)
|
✅ Final AssessmentThis PR demonstrates excellent architectural thinking and code organization. The refactoring successfully achieves its goals of code reuse and consistency by:
The implementation quality is high, with only a few issues that need addressing before merge: Critical: The infinite polling loop needs a timeout mechanism to prevent hanging indefinitely if the API doesn't respond as expected. Important: Adding unit tests will ensure the refactored code is robust and maintainable. Once the infinite polling loop issue is addressed and tests are added, this will be ready to merge. Status: ✅ Approve with requested changes (fix infinite loop, add tests) Great work on this refactoring! 🎉 File-specific references:
|
Summary
Adds the
celeste-google.veoAPI module for Google's Veo video generation API, following the same mixin pattern as GenerateContent and Imagen. Migrates the video-generation capability to use this shared API layer.Architecture
Changes
1. Google Veo API (
celeste-google.veo)Client Mixin:
/v1beta/models/{model_id}:predictLongRunninggeneratedSamples[0].videofrom responsegs://→https://storage.googleapis.com/)Parameters:
AspectRatioMapper:parameters.aspectRatioResolutionMapper:parameters.resolutionDurationSecondsMapper:parameters.durationSecondsReferenceImagesMapper:instances.referenceImageswith base64 encodingFirstFrameMapper:instances.imagefor image-to-videoLastFrameMapper:instances.lastFramefor interpolationConfig:
2. Video Generation Migration
GoogleVideoGenerationClientnow extendsGoogleVeoClientmixinconfig.py(now in API layer)celeste-googleas workspace dependency3. Core Utility
image_to_data_uri()function inceleste.utilsImageArtifactto base64 data URI for API requestsBreaking Changes
Parameter Mapper Rename
DurationSecondsMapperDurationMapperVideoGenerationParameter.DURATIONThe API layer uses
DurationSecondsMapper(matching the API fielddurationSeconds), while the capability layer usesDurationMapper(matching the capability parameterDURATION). This follows the established pattern where capability mappers have simplified names.Test Plan